/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lt.ntec.danblog.shared.utils.text;

import lt.ntec.danblog.shared.utils.Utility;

/**
 *
 * @author Tadas
 */
public class CamelCaseUtility implements Utility {

    @Override
    public String getProcessedValue(String value) {
        StringBuilder builder = new StringBuilder();
        
        String[] tokens = value.split(" ");

        for (int i = 0; i < tokens.length; i++){
            String val = tokens[i];
            String toLowerCase = val.toLowerCase();
            builder.append(toLowerCase.substring(0, 1).toUpperCase());
            builder.append(toLowerCase.substring(1));
            
            if (i + 1 < tokens.length) {
                builder.append(" ");
            }
        }
        

        return builder.toString();

    }
}
